<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>BabyOS: b_device.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="2.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">BabyOS
   &#160;<span id="projectnumber">V1.1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_b9223522bb56aee4ab59f7ba381d2163.html">bos</a></li><li class="navelem"><a class="el" href="dir_f2a2cc749b6bfcea90db6730434b0bd6.html">core</a></li><li class="navelem"><a class="el" href="dir_37b66dfbfdffce01c33ebea49c49c2c3.html">inc</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">b_device.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="b__device_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#ifndef __B_DEVICE_H__</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#define __B_DEVICE_H__</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; <span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="comment">/*Includes ----------------------------------------------*/</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="b__config_8h.html">b_config.h</a>&quot;</span>  </div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="structb_c_m_d___erase__t.html">   55</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct</span></div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;{</div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="structb_c_m_d___erase__t.html#ab439e3a90339e2e8ca8f82d4557a34e5">   57</a></span>&#160;    uint32_t <a class="code" href="structb_c_m_d___erase__t.html#ab439e3a90339e2e8ca8f82d4557a34e5">addr</a>;</div><div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="structb_c_m_d___erase__t.html#a7beea8f6745c478347f244cadef771c2">   58</a></span>&#160;    uint32_t <a class="code" href="structb_c_m_d___erase__t.html#a7beea8f6745c478347f244cadef771c2">num</a>;</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;}<a class="code" href="structb_c_m_d___erase__t.html">bCMD_Erase_t</a>;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="structb_c_m_d___struct__t.html">   62</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;{</div><div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="structb_c_m_d___struct__t.html#a1d127017fb298b889f4ba24752d08b8e">   64</a></span>&#160;    uint8_t <a class="code" href="structb_c_m_d___struct__t.html#a1d127017fb298b889f4ba24752d08b8e">type</a>;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <span class="keyword">union</span></div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    {</div><div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="structb_c_m_d___struct__t.html#a98946e69cf1ec51d231b3cc2a2b450e1">   67</a></span>&#160;        <a class="code" href="structb_c_m_d___erase__t.html">bCMD_Erase_t</a> <a class="code" href="structb_c_m_d___struct__t.html#a98946e69cf1ec51d231b3cc2a2b450e1">erase</a>;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    }param;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;}<a class="code" href="structb_c_m_d___struct__t.html">bCMD_Struct_t</a>;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;</div><div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="structb_driver_interface__t.html">   73</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct</span></div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;{</div><div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="structb_driver_interface__t.html#a857eaefcde68aba9fe0d2170a660fdfb">   75</a></span>&#160;    int (*init)(void);</div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="structb_driver_interface__t.html#a87e704566d0a15f1aabbbfb208438c81">   76</a></span>&#160;    int (*open)(void);</div><div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="structb_driver_interface__t.html#a533fda1241149e9fe787957492b2b1fc">   77</a></span>&#160;    int (*close)(void);</div><div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="structb_driver_interface__t.html#a92bf484ff16ad77727b6afe688c7e98e">   78</a></span>&#160;    int (*ctl)(uint8_t cmd, <span class="keywordtype">void</span> *param);</div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="structb_driver_interface__t.html#af67fbf8f75e899efac0872e7469a33c2">   79</a></span>&#160;    int (*write)(uint32_t addr, uint8_t *pbuf, uint16_t len);</div><div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="structb_driver_interface__t.html#a671c1e21440d7a8a58f1e244a4880d6f">   80</a></span>&#160;    int (*read)(uint32_t addr, uint8_t *pbuf, uint16_t len);</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;}<a class="code" href="structb_driver_interface__t.html">bDriverInterface_t</a>; </div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="preprocessor">#define B_DEVICE_REG(dev, driver, desc)</span></div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="b__device__list_8h.html">b_device_list.h</a>&quot;</span></div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;</div><div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="group___d_e_v_i_c_e___exported___types_definitions.html#ga1793ffbad2239c36ab43090841cf9fda">   88</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;{</div><div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="group___d_e_v_i_c_e___exported___types_definitions.html#gac84c032de111b645587293ce1373b668">   90</a></span>&#160;<span class="preprocessor">    #define B_DEVICE_REG(dev, driver, desc)    dev,</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="preprocessor">    #include &quot;<a class="code" href="b__device__list_8h.html">b_device_list.h</a>&quot;</span></div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <a class="code" href="group___d_e_v_i_c_e___exported___types_definitions.html#gga1793ffbad2239c36ab43090841cf9fdaab886891c64c883dc4b308e9b165fa571">bDEV_MAX_NUM</a></div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;}<a class="code" href="group___d_e_v_i_c_e___exported___types_definitions.html#ga1793ffbad2239c36ab43090841cf9fda">bDeviceName_t</a>;</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div><div class="line"><a name="l00108"></a><span class="lineno"><a class="line" href="group___d_e_v_i_c_e___exported___defines.html#ga04dfad1d8e6733a6441d2a2741e4b274">  108</a></span>&#160;<span class="preprocessor">#define BDEVICE_ERROR       1</span></div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div><div class="line"><a name="l00115"></a><span class="lineno"><a class="line" href="group___d_e_v_i_c_e___ctl_c_m_d___defines.html#ga96464751587c9b064a2c7cee9881402a">  115</a></span>&#160;<span class="preprocessor">#define bCMD_ERASE          0</span></div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;</div><div class="line"><a name="l00151"></a><span class="lineno"><a class="line" href="group___d_e_v_i_c_e___exported___types_definitions.html#gga1793ffbad2239c36ab43090841cf9fdaab886891c64c883dc4b308e9b165fa571">  151</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___d_e_v_i_c_e___exported___functions.html#ga404e753d491d3b3e4c6fba215d191fa7">bDeviceInit</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___d_e_v_i_c_e___exported___functions.html#gac022bd943e28b18b2dce587207c25788">bDeviceOpen</a>(uint8_t no);</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___d_e_v_i_c_e___exported___functions.html#ga580d17c32a7382f586cc11ba84160e09">bDeviceRead</a>(<span class="keywordtype">int</span> no, uint32_t address, uint8_t *pdata, uint16_t len);</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___d_e_v_i_c_e___exported___functions.html#ga7b100bfb070e715961c0bfe2da20d6be">bDeviceWrite</a>(<span class="keywordtype">int</span> no, uint32_t address, uint8_t *pdata, uint16_t len);</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___d_e_v_i_c_e___exported___functions.html#gaf8441490c33a1dfa5e56b510d332df29">bDeviceClose</a>(<span class="keywordtype">int</span> no);</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___d_e_v_i_c_e___exported___functions.html#gac8137793df6d7d8399128f4997cb0914">bDeviceCtl</a>(<span class="keywordtype">int</span> no, uint8_t cmd, <span class="keywordtype">void</span> *param);</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    }</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160; </div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;<span class="preprocessor">#endif  </span></div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;<span class="comment">/************************ Copyright (c) 2019 Bean *****END OF FILE****/</span></div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;</div><div class="ttc" id="group___d_e_v_i_c_e___exported___types_definitions_html_ga1793ffbad2239c36ab43090841cf9fda"><div class="ttname"><a href="group___d_e_v_i_c_e___exported___types_definitions.html#ga1793ffbad2239c36ab43090841cf9fda">bDeviceName_t</a></div><div class="ttdeci">bDeviceName_t</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00088">b_device.h:88</a></div></div>
<div class="ttc" id="structb_driver_interface__t_html"><div class="ttname"><a href="structb_driver_interface__t.html">bDriverInterface_t</a></div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00073">b_device.h:73</a></div></div>
<div class="ttc" id="group___d_e_v_i_c_e___exported___functions_html_gac8137793df6d7d8399128f4997cb0914"><div class="ttname"><a href="group___d_e_v_i_c_e___exported___functions.html#gac8137793df6d7d8399128f4997cb0914">bDeviceCtl</a></div><div class="ttdeci">int bDeviceCtl(int no, uint8_t cmd, void *param)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8c_source.html#l00232">b_device.c:232</a></div></div>
<div class="ttc" id="group___d_e_v_i_c_e___exported___types_definitions_html_gga1793ffbad2239c36ab43090841cf9fdaab886891c64c883dc4b308e9b165fa571"><div class="ttname"><a href="group___d_e_v_i_c_e___exported___types_definitions.html#gga1793ffbad2239c36ab43090841cf9fdaab886891c64c883dc4b308e9b165fa571">bDEV_MAX_NUM</a></div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00151">b_device.h:151</a></div></div>
<div class="ttc" id="b__device__list_8h_html"><div class="ttname"><a href="b__device__list_8h.html">b_device_list.h</a></div></div>
<div class="ttc" id="group___d_e_v_i_c_e___exported___functions_html_ga580d17c32a7382f586cc11ba84160e09"><div class="ttname"><a href="group___d_e_v_i_c_e___exported___functions.html#ga580d17c32a7382f586cc11ba84160e09">bDeviceRead</a></div><div class="ttdeci">int bDeviceRead(int no, uint32_t address, uint8_t *pdata, uint16_t len)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8c_source.html#l00178">b_device.c:178</a></div></div>
<div class="ttc" id="b__config_8h_html"><div class="ttname"><a href="b__config_8h.html">b_config.h</a></div></div>
<div class="ttc" id="group___d_e_v_i_c_e___exported___functions_html_gac022bd943e28b18b2dce587207c25788"><div class="ttname"><a href="group___d_e_v_i_c_e___exported___functions.html#gac022bd943e28b18b2dce587207c25788">bDeviceOpen</a></div><div class="ttdeci">int bDeviceOpen(uint8_t no)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8c_source.html#l00160">b_device.c:160</a></div></div>
<div class="ttc" id="structb_c_m_d___struct__t_html"><div class="ttname"><a href="structb_c_m_d___struct__t.html">bCMD_Struct_t</a></div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00062">b_device.h:62</a></div></div>
<div class="ttc" id="structb_c_m_d___erase__t_html"><div class="ttname"><a href="structb_c_m_d___erase__t.html">bCMD_Erase_t</a></div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00055">b_device.h:55</a></div></div>
<div class="ttc" id="structb_c_m_d___struct__t_html_a1d127017fb298b889f4ba24752d08b8e"><div class="ttname"><a href="structb_c_m_d___struct__t.html#a1d127017fb298b889f4ba24752d08b8e">bCMD_Struct_t::type</a></div><div class="ttdeci">uint8_t type</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00064">b_device.h:64</a></div></div>
<div class="ttc" id="structb_c_m_d___erase__t_html_a7beea8f6745c478347f244cadef771c2"><div class="ttname"><a href="structb_c_m_d___erase__t.html#a7beea8f6745c478347f244cadef771c2">bCMD_Erase_t::num</a></div><div class="ttdeci">uint32_t num</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00058">b_device.h:58</a></div></div>
<div class="ttc" id="group___d_e_v_i_c_e___exported___functions_html_ga7b100bfb070e715961c0bfe2da20d6be"><div class="ttname"><a href="group___d_e_v_i_c_e___exported___functions.html#ga7b100bfb070e715961c0bfe2da20d6be">bDeviceWrite</a></div><div class="ttdeci">int bDeviceWrite(int no, uint32_t address, uint8_t *pdata, uint16_t len)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8c_source.html#l00195">b_device.c:195</a></div></div>
<div class="ttc" id="structb_c_m_d___erase__t_html_ab439e3a90339e2e8ca8f82d4557a34e5"><div class="ttname"><a href="structb_c_m_d___erase__t.html#ab439e3a90339e2e8ca8f82d4557a34e5">bCMD_Erase_t::addr</a></div><div class="ttdeci">uint32_t addr</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00057">b_device.h:57</a></div></div>
<div class="ttc" id="structb_c_m_d___struct__t_html_a98946e69cf1ec51d231b3cc2a2b450e1"><div class="ttname"><a href="structb_c_m_d___struct__t.html#a98946e69cf1ec51d231b3cc2a2b450e1">bCMD_Struct_t::erase</a></div><div class="ttdeci">bCMD_Erase_t erase</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00067">b_device.h:67</a></div></div>
<div class="ttc" id="group___d_e_v_i_c_e___exported___functions_html_gaf8441490c33a1dfa5e56b510d332df29"><div class="ttname"><a href="group___d_e_v_i_c_e___exported___functions.html#gaf8441490c33a1dfa5e56b510d332df29">bDeviceClose</a></div><div class="ttdeci">int bDeviceClose(int no)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8c_source.html#l00214">b_device.c:214</a></div></div>
<div class="ttc" id="group___d_e_v_i_c_e___exported___functions_html_ga404e753d491d3b3e4c6fba215d191fa7"><div class="ttname"><a href="group___d_e_v_i_c_e___exported___functions.html#ga404e753d491d3b3e4c6fba215d191fa7">bDeviceInit</a></div><div class="ttdeci">int bDeviceInit(void)</div><div class="ttdoc">Device Initialize. </div><div class="ttdef"><b>Definition:</b> <a href="b__device_8c_source.html#l00129">b_device.c:129</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
